

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Fast Card 卡片快制</title>
    <style type="text/css" media="screen">
#cvs{height:370px;height:500px;border:1px solid red}
    </style>
  </head>
  <body>
  
  <h1>canvas测试.</h1>
  <canvas id="cvs1"></canvas>
  
  </body>
</html>

<script>
function drawBeauty(beauty){
var mycv = document.getElementById("cvs1");  
var myctx = mycv.getContext("2d");
myctx.drawImage(beauty, 0, 0);
}
function load(){
var beauty = new Image();  
beauty.src = "http://www.gxgj.com/public/60xiaoqing/img/ban2.jpg"; 
if(beauty.complete){
   drawBeauty(beauty);
}else{
   beauty.onload = function(){
     drawBeauty(beauty);
   };
   beauty.onerror = function(){
     window.alert('美女加载失败，请重试');
   };
};   
}//load
if (document.all) {
  window.attachEvent('onload', load);  
  }else {  
  window.addEventListener('load', load, false);
  }






</script>
